//
//  ShouCangViewController.m
//  網易
//
//  Created by 赵天宇 on 16/9/18.
//  Copyright © 2016年 赵天宇. All rights reserved.
//

#import "ShouCangViewController.h"

@interface ShouCangViewController ()<UIScrollViewDelegate>{
    UIScrollView *scrollV;
    UIScrollView *titleV;
    UIButton *text;
    UIButton *gentie;
    UIButton *pic;
    UIImageView *imageV;
    UIImageView *imageV_2;
    UIImageView *imageV_3;
    UILabel *lable_1;
    UILabel *lable_2;
}

@end

@implementation ShouCangViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationController.navigationBar.barStyle=UIBarStyleBlack;
    self.navigationController.navigationBar.barTintColor=[UIColor redColor];
    self.navigationController.navigationBar.tintColor=[UIColor whiteColor];
    self.title=@"我的收藏";
    UIBarButtonItem *rightItem = [[UIBarButtonItem alloc]initWithTitle:@"编辑" style:UIBarButtonItemStylePlain target:self action:nil];
    self.navigationItem.rightBarButtonItem=rightItem;
    scrollV = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 94, self.view.frame.size.width, self.view.frame.size.height)];
    scrollV.delegate=self;
    scrollV.bounces=NO;
    scrollV.pagingEnabled=YES;
    scrollV.backgroundColor = [UIColor cyanColor];
    scrollV.contentSize=CGSizeMake(3*self.view.frame.size.width, self.view.frame.size.height);
    [self.view addSubview:scrollV];
    titleV=[[UIScrollView alloc]initWithFrame:CGRectMake(140, 64, 200, 30)];
    titleV.delegate=self;
    titleV.bounces=NO;
    titleV.contentSize=CGSizeMake(200, 30);
    [self.view addSubview:titleV];
    text=[UIButton buttonWithType:0];
    [text setTitle:@"文章" forState:0];
    text.tag=1;
    text.frame=CGRectMake(0, 0, 40, 30);
    [text addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
    [text setTitleColor:[UIColor blackColor] forState:0];
    text.titleLabel.font=[UIFont systemFontOfSize:14];
    [titleV addSubview:text];
    pic=[UIButton buttonWithType:0];
    [pic setTitle:@"图片" forState:0];
    pic.tag=2;
    [pic addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];

    pic.frame=CGRectMake(50, 0, 40, 30);
    [pic setTitleColor:[UIColor blackColor] forState:0];
    pic.titleLabel.font=[UIFont systemFontOfSize:14];
    [titleV addSubview:pic];
    gentie=[UIButton buttonWithType:0];
    [gentie setTitle:@"跟贴" forState:0];
    [gentie addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
    gentie.frame=CGRectMake(100, 0, 40, 30);
    [gentie setTitleColor:[UIColor blackColor] forState:0];
    gentie.tag=3;
    gentie.titleLabel.font=[UIFont systemFontOfSize:14];
    [titleV addSubview:gentie];
    imageV =[[UIImageView alloc]initWithFrame:CGRectMake(50, 150, 300, 80)];
    imageV.image = [UIImage imageNamed:@"favorite_default_message@2x.png"];
    [scrollV addSubview:imageV];
    lable_1=[[UILabel alloc]initWithFrame:CGRectMake(100, 250, 300, 20)];
    lable_1.text=@"时光已飞逝哪些重要的事?";
    [scrollV addSubview:lable_1];
    lable_2 = [[UILabel alloc]initWithFrame:CGRectMake(150, 270, 120, 20)];
    lable_2.text=@"收藏它们吧";
    [scrollV addSubview:lable_2];
        // Do any additional setup after loading the view.
}
-(void)click:(UIButton *)sender{
    if(sender.tag==1){
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:0.3];
    sender.titleLabel.font=[UIFont systemFontOfSize:18];
        [sender setTitleColor:[UIColor redColor] forState:0];
        pic.titleLabel.font=[UIFont systemFontOfSize:14];
        [pic setTitleColor:[UIColor blackColor] forState:0];
        [gentie setTitleColor:[UIColor blackColor] forState:0];
        gentie.titleLabel.font=[UIFont systemFontOfSize:14];
    [UIView commitAnimations];
    }else if (sender.tag==2){
        [UIView beginAnimations:nil context:nil];
        [UIView setAnimationDuration:0.3];
        sender.titleLabel.font=[UIFont systemFontOfSize:18];
        [text setTitleColor:[UIColor blackColor] forState:0];
        [gentie setTitleColor:[UIColor blackColor] forState:0];
        [sender setTitleColor:[UIColor redColor] forState:0];
        text.titleLabel.font=[UIFont systemFontOfSize:14];
        gentie.titleLabel.font=[UIFont systemFontOfSize:14];
        [UIView commitAnimations];
    }else
    {
        [UIView beginAnimations:nil context:nil];
        [UIView setAnimationDuration:0.3];
        [sender setTitleColor:[UIColor redColor] forState:0];
        sender.titleLabel.font=[UIFont systemFontOfSize:18];
        [text setTitleColor:[UIColor blackColor] forState:0];
        [pic setTitleColor:[UIColor blackColor] forState:0];
        text.titleLabel.font=[UIFont systemFontOfSize:14];
        pic.titleLabel.font=[UIFont systemFontOfSize:14];
        [UIView commitAnimations];
    }
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
